added preprocessing, diverse code changes