making generate_view more generalizable