add prior and detect