small cleanup and a few comments added to the code