Improved the code to control actions in the game node