Implement flexible target specification

See commit message.
This may want to link to the PR instead of this location as it will change once the RFC is completed.