Get delay function working properly