second commit. fixed gold count with refactored code