finished inversion of control part