broke up run() and a lot of refactoring