Readability would be improved with `var validCategory = function(category)` instead of `val`