cleaning up slabify function