refactoring, data structure fix