Implement flexible target specification

See commit message.
This seems like a lossy transformation, why return `Option` when it's always `Some`?