Clean-ups, rewrite