Better HTTP redirect handling; bug fixes

With more handy functions being created in the process! ^^