Added context loading for game template, fixed bug with it and added code to handle game cycle.