bad implemation to save prob8.java