Improve code structure