restructure code to match namespace