Improving validation. More specific errors are issued now.