debugged code!!!