Added some documentation, an extra measure and fixed some bugs