base case and build