added data checking instead throwing exceptions