code optimization and add pagination - Steven G