Scala cleanup + 3.12.1

Lots of scala conversions + a couple of bugfixes reported by a user.