Transfered scripts from gist