firefox doesn't like functions in a block, fix all remaining jshint warnings