smoother allocation code