Algh refactoring