fixing and adding more logging