Refactored and modernised the base implementation.