Various attempt to optimize stability of periode detection.