some progress... algo still wrong...