modify get appointments function