added support for resolving redirects (addresses #3)