Refactor to generic views