Functionality has been moved to separate (generic) library

- Because it's easy to test
- And also including new tests