Added slightly modified version of original script