modified original code