cleaning up messy code in view in a helper