[WIP] Rewrite solver

__TODO__ Explain mark approach