Problem on running a script on the AR.Drone 2.0

Hey,
I am trying to create lessons for students on algorithmic using the AR.Drone 2.0. Therefore I want to lower the necessary understanding on programming to a bare minimum. Because of this I am rewriting the methods given in the node.js library ‘ar-drone’ from nodecopter. If my program is still small ( has only one method declaration) the method runs without any problem and the drone lifts off the ground. However the moment I make the script more complex by adding more methods(functions) the script stops to run properly, even if the methods itself should run without any problem. This also seems to happen in for and while loops. If the loops get more complex, the drone doesn’t run the script properly.
Does anyone know a solution for this or can give me a hint on where my problem resides.

Greetings Florian