implemented with tests