Cleaned up java code, fixed run.sh dirs being deleted