finished temp restructure into modules, fixed bugs caused by restructure