Added a lot of validation, but not complete.