Asset detection moved to function.