Updates code to latest, added more comments