Code cleanup and some nice comments