Moved some logging around
Changed to new API