added sleep() to make debug output nicer