javascript: move runtime into own js file