split up big function
get type right
split up big function
remove redundant var
add some whitespace
factor out form lookup
split up big function
remove redundant parens
take short cut out of function
reorder branches
add blank line
remove redundant else
factor branches together
remove redundant assignment