Housekeeping and handler for map panning.

Removed unused functions, added comments and moveend event handler.