Minor code fixes, added flow chart!