Adding subdomain support

Ready to merge.