Added even more validity checks