added some docs
avoid some unnecessary arraylist creations
added allocation tracker
more caching, less memory allocation