Applied formatting and organizational changes from PR review. This closes #3242. Signed-off-by: Andrew Lim <andrewlim.apache@gmail.com>