stella's algorithm