mergered the code ,with errors