small script refactor
added javascript console