tidied some code using Filter() instead of [