input preprocessing