Added functionality to Scala, fixed minor bugs in JOE