refactor
finally figured out a good oop way of organizing this
fix up a few bugs