refactor and restructuring the models