Added some extra checks