cleanup,commenting, formatting

deleted obsolete variables, added comments