add friend view and refactor some code in…