Try to make wrapper.js more readable

(Hopefully correctly this time).