since this is exactly the same code except for < and >, can we please make this a shared private method with a param