Adding self-restart and DB cleanup