refactored the modified function _fill so that the code follows the raty style of codes