Slight refactoring of action filter.