modified java to keep data