Added some comments and small tweaks