-- separating out view generation function