updated map js logic