Added more code refactoring