Assigned to vars to avoid global variables. Added map bounds event listener. Refactored.