implemented restart and cleaned up some stuff