micro optimized greedy solver a bit