Cleaner rewrite