reworked view code to do things the right way