Added more documentation to the code and fixed a bug in the validators.