refactor. ugh