Updated script with minor syntax/JSHint fixes