coin detector updates: works in ML and Java