Beginning to optimize code for memory use