Adapt code to step1 of TTD2