Improve code a little bit. Thanks again to Vladimir