Improved the recursive defaults function.