some refactor in model