define map and filter for applying logic to functions