Updated per Seth's guidance. Now fully unit tested.