remove unnecessary spaces and empty line.