debugging complete! now restructured