Full script gisted here: https://gist.github.com/johnnyshields/10963650