Added comments and renamed few methods