Adding original code from https://code.google.com/p/pinkie-live/