Removed code duplication in the safeguards