function hooks sync and async