fixed while brace
removed trailing whitespace