Added tests and increased documentation.