Fixed several bugs in PrivateMessage class + refactoring