Copyright (c) 2009 Sergei Kozlov, released under the MIT license