add js logic and pagination