Some Improvements
more cleanup
only errors are related to map pointer indexing