Did some refactors