Some refactoring to make it possible to run as a service within OpenWayback