changed if statement to case statement, shortened variable names