Add logging and implement restart