web interface: refacator filtering into a standalone function, use it widely