Smooth transition with a better method of deciting when to transition and when not to. Also added a code sample via Gist.