Refactor and New Functions

I've taken out global definitions and functions from the onReady event
and created two new functions to add a new place and category.