Rewrite/refactor.

Signed-off-by: Tod Fitch <Tod@FitchDesign.com>