inclduded wait function