refactor for huge pages