This is an attempt to answer this challenge https://gist.github.com/michaelnoonan/5566257