added delay checking code. Hope this doesn't explode....