some refactors.