Improve the structure of the code