further simplified code