Code improvements

This PR hasn't big functionality changes. Only code style improvements and fix messages.