added pagination but it doesnt work quite right