refactoring submit map js in prep for offlining