Refactor models and index controller