Improving memory consumption