Improve structure and add some tools