fixed bugs and passed in variables to javascript
fixed merge conflict