add filtering functionality and fixed everything