subroutine ingestion(act,Eb,BeamAtt,Prey_mgdw_per_m3,Larval_m,PauseDuration,xnum,PreyVarMagnitude,PreyMassEnc)
 implicit none

 !Parameters
 real*8, parameter:: PreyRelLength=0.05				!Prey length relative to fish
 real*8, parameter:: PreyWidth = 0.5					!Prey diam:length ratio (for mass)
 real*8, parameter:: PreyContrast=0.3
 real*8, parameter:: VisRtoSDPreyinBL=1.			!=1 BL for a 0.015 mm2 prey (Fiksen & MacKenzie 2002)
 real*8, parameter:: Ke = 1.
 real*8, parameter:: omega = 0.
 real*8, parameter:: PreySwimVel = 0.
 real*8,  parameter :: Prey_handling_s = 1.			!Prey handling time (s)
 real*8,  parameter :: rho = 0.3						!Time to move between search volumes
 real*8,  parameter :: Pc = 0.2						!Prey capture probability (Fiksen & MacKenzie 2002: 0.2)

 real*8, parameter:: VisFieldShape = 0.5
 real*8, parameter:: zp_mgdw_per_m3 = 1025*0.25*1.d6 !Mauchline..

 !Variables
 integer, intent(in) :: xnum
 real*8, intent(in) :: Prey_mgdw_per_m3, PreyVarMagnitude
 real*8, intent(out) :: PreyMassEnc(0:xnum)
 integer	IER, x
 real*8 Eb,BeamAtt,Larval_m, VolumeSearched
 real*8 Prey_m,Prey_mgdw,PreyPer_m3,PreyImageArea,Swim_m_per_s
 real*8 VisualRange,EyeSens,pi
 real*8 act,PauseFrequency,PauseDuration

 !Functions
 real*8 Weight_Length
 real*8 Length_Weight

 pi=acos(-1.)

 !Prey properties
 Prey_m = Larval_m*PreyRelLength	!Prey length (prosome?)
 !Prey_mgdw = (4/3.)*pi*((0.5*Prey_m)**3.)*zp_mgdw_per_m3 !Spherical prey
 Prey_mgdw = pi*((0.5*PreyWidth*Prey_m)**2.)*Prey_m*zp_mgdw_per_m3 !Cylindric prey (diam=Pw*L)

 !PreyImageArea = pi*(Prey_m*0.5)**2						!Spherical prey
 PreyImageArea = pi*(Prey_m*PreyWidth)*Prey_m*0.75		!Elongate prey 

 !Assume larvae detect 0.1x0.2 mm prey (VisRtoSDPreyinBL x Larval_m) away in clear water 
 !(from Fiksen&MacKenzie 2002):
 EyeSens = ((Larval_m*VisRtoSDPreyinBL)**2.)/(PreyContrast*(0.1*0.2*0.75*1.d-6))

 Swim_m_per_s = Larval_m

 !Finding the visual range in m (from AU97)
 VisualRange = dsqrt(EyeSens*PreyContrast*PreyImageArea*(Eb/(Ke+Eb))) !Approximation
 if(VisualRange>0.05)then	!Exact visual range (above ca 5 cm)
  call getr(VisualRange,BeamAtt,PreyContrast,PreyImageArea,EyeSens,Ke,Eb,IER)            !!! Consider a lookup-table
 endif

 !Cruising larvae:
 VolumeSearched = act*VisFieldShape*pi*(VisualRange**2)*Swim_m_per_s
 
 !Holling disk foraging process
 do x = 0,xnum 
  PreyPer_m3 = Prey_mgdw_per_m3/prey_mgdw					!Mean prey density
  PreyPer_m3 = PreyPer_m3*(1.+ (2.*(dble(x)/dble(xnum))-1.)*PreyVarMagnitude)  !Prey varies with x around mean, with magnitude given by PreyVarMagnitude(proportion i.e. 1=100%)
  PreyMassEnc(x) = (Pc*VolumeSearched*PreyPer_m3*Prey_mgdw)/(1. + VolumeSearched*PreyPer_m3*Prey_handling_s)
 enddo
  
 if (act .lt. 1.d-10) PreyMassEnc(:) = 0. !No feeding if not moving

 return
 end subroutine ingestion
 !******