Model backend

Working fine. Might need some changes.