additional optimization as per HTTL author's suggestion