Refactoring progress 1
Finished for the night
major refactoring