misc cleanup and better handling of component flow