Reformatted code to match current guidelines (braces on next line, etc).