refactoring rep & flies structure