Added comments and made some final tweaks