simplification of lb.js implementation