Detailed explanation of the code inside.
Saturation trick from: https://scratch.mit.edu/projects/566046891