Silence jshint complaint about variables already being defined.
Refactor away if test.
Refactor: Move function out of containing function, and rename.
Rename function.