changed controller for reusability