design fix and refactoring