Further program and memory optimizations