cleaned the unnecessary code of 'maxid'