removed trailing whitespaces and extra newlines