Updated version with code ready to add filters