Mega refactoring