added most of messaging functionality