cleaning up a bit and adding comments