moved preprocessing to a class