added proper logging