Added tests, updated documentation and code style