added preprocessing functions