Added waitForChangeState func
Added init section
Added debug print function