Refactoring main/live