First working draft.

Obviously needs some more work, especially with the validate method.