simplified code to be more consistent