added comments for refill()