Making the code more functional for fill.