Fixed quality issues. Added minor tests. Improved documentation