recoded script stuff