page-flags: move code around