Implement and add tests