moved js code into a Bug object see bug.js