Fixed the message generation loop, fixed prints (now uses logging)