For Daniel, I will post my debugging.

I debugged your code, and improved with my new definition of the
library. I will upload the Wiki instruction soon. See and hope it helps.