Enhancement: put IMC handling into separate class

nothing special but copy paste and some local variables