fixed while brace
fixed catch brace
removed trailing whitespace