Address review comments, mark @VisibleForTesting