moved method to module to be reused in block_view