modernize guard implementation