added sample parameter to rewrite script