fixing flow and DOM manipulation
flow much tighter now