added localnoise function