several changes.
added map
code cleanup