Refactoring, general cleaning. 99% there