Please see this blog post for an in depth explanation. All code is provided under the MIT License. See MIT-LICENSE for details.