implmented transitions. (still buggy)