Added automatic transitions and a couple of bug fixes