Tests and Refactoring
Refactoring
Done with first round of refactoring