Added some general comments, removed inline comments and edited indentaion