1st implementation with tests