checked coding style, small refactory