move Listening inside main block