Remove unneeded code and add a few comments here and there.