Refactored recursive fill