add some function to model to make it more modular
fix route