base case and size input refined