Made some small tweaks to the code, added comments