Implement flexible target specification

See commit message.
How come this stopped calling `for_target`?