fixed duplicate coins

extra code cleanup included