see https://bitcointalk.org/index.php?topic=279249.0