Made the controller DRY