fix conditonal
moving the existing refactor book code here