refactor patients page