first pass at conversion, automated mostly using py2scala