Final code for revision.