Reduce time and memory