Finished validation function