refactored bad code away