Added some extra checks to validity