The author wrote very well, simple and clear, rearrange it when you are free

https://www.hbiger.com/index.php/archives/18/
Copy the code