Tilde expansion and refactor detect functions