Adding comments and 1st clean up 

This is to be continued as the code lack comments and remove dead code removals