Based on http://code.google.com/p/tongue-tied/