Add memory classes, restructure files