lots of refactoring, also moved all script to commerce.js except in widgets