Add a preprocessing function & horizontal checking function