restructured for clean layering