fixed issue with map not resetting after state change, removed unused code, added map functions to scope