Code improvements.

I think that my variant is better. Look at my code and take decision.