Refactor to remove duplicates on erb files