Move shared code into functions.
Move shared code into functions.

This ensures that even if there are conflicting functions that we always call the functions we care about.

skatejs/skatejs,skatejs/skatejs,chrisdarroch/skatejs,skatejs/skatejs,chrisdarroch/skatejs