Rewrite to improve flow