migrating plugin from Gist (https://gist.github.com/2ndkauboy/59288a282381e2b7ba6d) to Github