Added check for validity