worked out functors
abstracted hashmap a little
remove trailling spaces