move status message at the beginning of the function