Added extra filter type.
Removed comments and use resolve instead of cast.
added functions array, so no extra loop is required.