Improves previous solution