added states, threads and wait/notify