simplified code again