refactoring. new data class definition is easier now