Improvements to slab code