memory optimizations and pad number debugging