Removing some duplication, fixes two fatal errors.