fixing code intendation and adding java docs