preprocessing input