small bug fix, and some more commenting