improved batch size selection