more implementation and tests