add preprocess function and rename mandatory to required.