Finally  compiles and does not accept fail times!

mem alloc still to be done/checked