preprocessing became a function