Added filtrate function for databases