First round of refactorization... More to come