Fix/double javascript

This is work in progress. Don't merge yet.