Initial re-factor done

Eeeeuuuuuuucccchhhh