Second half of the first revision. Fixed the references too.