Added tests, implementation