further preprocessing to handle arbitrary spaces and newlines