setJs method refactored slightly