made code better (consolidated view closures, made entity struct)