Js transfer

Ykat, take a look at these changes. If you're cool with everything, we can merge it with master.