Self-updating Script implementation. Origin from: http://www.stevesouders.com/blog/2012/05/22/self-updating-scripts/