second portion of #15, added better filtering + pagination + better queries