BOS1402567 refactor for memory usage