Refactor show view and database calls