Refactor of code in effects. Using data_priv