It works like magic, but it is actually science.