refactored accept_coins method