refactored variables and function names