Make it possible to specify service directory

This also adds some tests and exposes the timestamp of the current state