updated version for more dynamic coin functionality