implemented basic pagination