Moved functions for noise estimation