refactor view construction: make it more iterator-friendly