master #10 add reallocation algorithm