refactored variable names
minor changes made