added checking conditions