optimized save method