refactored to make it more organized
removed temp files