refactor appointment module