Moved map onClick events to a separate method for easier coding.