Tests and a bit more abstraction