Fixed bugs, added flow