Strengthened the flow graph code so it doesn't break when a loop is present in the level and did more speed optimization.