Move JavaScript code to init function to ensure Google Maps JavaScript code is loaded first