Transfered code from view to controller