fixed some tests (2 still failing), move some logic out of the views