Refactor cas linking to its own controller