Refactor functions to update consumed size