Implemented filtering functionality