start of rewrite logic of the private messages