cleaning and factorising

tidying up for irrevelant print
factorising views code