added validity checking ability