Update maputils.js

Added a couple more util functions, cleaned up a little code.