Clean up code. Kind of embarressed about the indent bracket style.