Added some views. Modified endpoits to use views