refactoring medium ai