Update solution. Optimize space