inserted the logic