Change logic to use message layer