Some refactors and planning