templatehashmap

* replaced std::map with templatehashmap, just so that more of the code
is understandable and modifiable
* fixed angles math for v2