move more files out of index.js