Factor code to ease a lot future implementations.