Move pre-processing functions inside the jQuery context

To avoid polluting the global namespace