Condense code in 3d