Tidied the implementation of sentinels.