refactor our common code