Moved all functions except restart to python