changed faulty code