Refactored variable names and cleaned up comments