Refactor for cleaner repository and views