initial implementation with tests