assign params to local variable instead of calling params multiple times. use case statement instead of i/elsif for readability