Clarified variable names, removed unused code