Optimized some functions. Added one solution