extracting binary functionality to js file