begun conversion to java