1. Refactored the code. Proper functions for different functionalities.
2. Moved to underscore case variable and function names