Added proper logging