many changes
reworked order of execution