how gold mining plant works