Added filter functionality that allows either to filter by an array of filetypes or through a callback function