Simplify and refactor