changed the views and fixed the query