WORKING code.if running from mac, change m_waits to be shorter