struggling with java, cleaned up walking code