rewoeked code and added pageview implementation