Copied over ryans changes