Some refactoring, add task for clearing the db