Code refactor. Fixes rSKc39d64cd5a1b