first working version in Java.