separating common logic