* loads of refactoring
* added a startup hook that generates all necessary data on first
startup