fixed indentation, added select statement, added callback for own message send