reworked for the new workflow

code cleanup
fixes and improvements