remove trace messages and restructure