Refactor zeroFill code