Add maps functionality, major refactor