Fix null pointer exception and remove friend ordering on new message
Removing unsued functions
Solve conflicts resulted from merge. Upstream had priority.