Major refactorization