Improve code reuse and reduce complexity