maintenance:
correct Scala idioms and improved code formatting