Made modification to script so it can run under root