refactored code and cleaned up naming. Final commit