refactored to fix naming conventions and remove unnecessary code