Refactor

@arkham @matjack1 please...take 10 minutes to review or to test it directly from pioneerskies:refactor branch