reworked authorization and sending messeges