Some fixes and cleanup of modsystem, still working on it