code refactoring / redesign