improved force.js code