add more documentation, make some methods private