removed duplicated variables and fixed broken tests

Some data are duplicated and being set to view. I have reduced the
number by mainly using the one variable and grabbing the
appropriate data from it in the view. Due to this change, some
of the tests broke, which I have also fixed in this commit.