Fix minor typos

Fixes some a few places where the jQuery `$` was being used without it being passed in to the function closure.
Also fixes some indentation issues I saw while fixing the above.