Add basic subnet support

Supercedes #23