lots of refactors
big commit