Added beter validators to prevent possible error conditions