rewrite some written-while-buggered erb code