Updated documentation and added tests