Update extension.js

fixed some bugs
still to do:
fix up wording and comments
more compliant to docs