more checking functions added but not tested