Added some comments + fixed minor issues