added pagination controlling