Refactored code for brevity, deleted extra files