factor out js file