Tidy up: fixed curly braces and removed unneeded else statements.