Added privatemsg module support and addressed code review feedback.