Added comments and changed visibility of some methods