Implement flexible target specification

See commit message.
Is it crazy to reorder these so that the required fields are together at the start of the definition?