Adding completion and variable detection to details function