wrote coalesce and checkForFreePage