Complete rewrite of core modules