added types to help Scala inference