move view construction to external functions