Implemented validator functions for shorter and more efficient code