modified frame.js file, reworked this guy's code