Fixed bugs and decreased max stack