Improved some naming and added a few comments.
Adds some tests and changes to access control.