Optimized Storage algorithm