refactoring: map+if -> filter+map