Added tests, more implementation