initial refactor of the model layer