Implement auto transition and fix previous bugs in manual transitions.