delay function works now