adding logging functonality