Review from H4ns and port to CCL.

H4ns provided great feedback and the code is improved.

The port to CCL was a bit trickier.