restructured for use of modules