mostly adding comments.. and pruning dead code