Adds missing Javadocs and improves code formatting.