Ksi refactored