added some comments and cleaned up java recipe