added pagination to main view