Defining filtermap since it is not included in all erlang versions.