Unit tests and some abstraction