refactored index method to list appointments