adding pagination - fixes filtering and minor bugs