Implemented the task and a simple test suite