Reduce scope of tmp variable
Refactor nested if statement
Don't abbreviate variable name
Fix broken cuke