Changes to logic / order of operations

Reworked to remove re dependency