Improved produced javascript code