Another complete rewrite