big restructure and simplification