Added some comments and small fixes