Refractor to use generic views