Improve code style
Make function definition local