note memory use improvement