add some comments and clean things up