Cleaned up; added JavaDoc.