The code seems fine, I still haven't tested the module.
You need to look into...