Continued refactoring
Done refactoring for now
merge