https://gist.github.com/vincentorback/9649034 added