Extract common functionality to module