added thread sleep