Restructure core.js
Fixes to core.js to work with FTP.js