moved delay to define