Introduce tests; segregate code and specs