Started converting code from Scala to Java