Code cleanup; added JavaDoc.