implemented almost all message functions