Move view logic into view phps