replaced sending message by a function call