Fixed #7 (untested, but should work) and commented some lines of code to help other devs understanding something