latest version with improvement on the preprocessing