Fixed a map.connect() bug. Minor enhancements to reduce the code (but keep functionality the same).