modified the java homeless code again