refactored coins class