Improve validation in definition class