changed logic but not working