Added onload validation logic