moved database init to controller