creating mergin pages in right order