The map lookup and add functions now work. Finished refactoring the JS.