use rewrite instead of return