Fix null pointer exception and remove friend ordering on new message
Removing unsued functions
Merge remote-tracking branch 'upstream/master'