original routine for checking eb max and full implementation