Wonderful reusable code from Twitter