Fix view helper and add unit tests