Refactoring done for the most part
First part of the refactoring done. Next phase is getting everything to work again