refactoring codes in abs heap for prep writing to disk