some cleanup in view generation logic