updated code to be more dynamic and to accept tasks and appointments