cleaned out dead code, added comments