refactor source to inner class