Removed use of map throughout the code

- Also cleaned a bit of dead code