restructure, implement mw coding conventions