added some comments and removed some old unneeded code