Made the  code more representative of the original spec