Added validator library. Edited callback so not being called multiple times within the function.