this turned out kinda messy