refactored common code;
added Validate() functionality;