Added URL parsing to determine selected controller and media on page load