Improving the code structure