Added a few comments and removed a few useless lines of code