Added comments and small tweaks