added pagination and model validation