Refactor fields to inner class where they are used