Update user-extensions.js

More cleanup, refactored command loop