Cleaned up script from the following screencast:  http://t.co/ZZoNlxuFJG