Re-implement logic for controller and view