use scala traits instead of java code