According to the Art Scroll Siddur bend the knees at kor'im (bend the knee), bend at the waist at mishtachavim (bow) and straighten up after modim (acknowledge) before lifnei melelech. I do not know where Rabbi Nosson Scherman got the original psak that this is the method. It is also the way that I was taught to daven in cheder (lo those many years ago) but I do not remember any particular source. I think that when something is learned in kindergarten or first grade, it becomes automatic to continue.