Refactor out some functions
Removed old files