Extract common handling