Refactored for compatibility