improve code structure