added pagination logic and style