moved logic class definitions to Scala