refactor js maps