Cleaned up code; variable names need a touch-up