Initial implementation with tests