Tidy up some style:
* Return from mode() with a one-line ternary
* At start of execution, return false (exit script) if the input is bad; otherwise, the rest of script executes at root level
(Thanks, @toastynerd!)