Update extension.js

added comments
deleted unused functions
updated format