added helpers to reduce repetition of code in controllers