implemented new Module class, various changes to new model code