added john.js
moved functions to john.js