Major Fixes

Reorganized some code and fixed URL parsing. Still some issues with the
call stack when the cap on URLs is high (tested at ~500)