added code for maxsep