Refactored coding conventions and optimized the code logic (hopefully). -Ty