added functions to preprocess; corrected terminology