changed Design and did refactoring