messy refactor
cleaner refactor