initial simplistic recursive solution