Fix referer error, simplify parameter grabbing