Reorganization of some source files, and removal of dependancy on corelib to compile