Cl refactoring

Refactor things a bit, still not good though.