modified for BlueJ use.