Move controler logic to before filter method
Move saving link history out of if