Placed all function block curly braces to start on line of function prototype or flow control statement. Also optimized some flow control to make more visual sense by removing unnecessary curly braces