Refactoring, resolve working bad