Added a few comments where useful.