Add logging to functions