added interface, more work later
canged java version