take short cut out of function
reorder branches
add blank line
remove redundant else
factor branches together
remove redundant assignment