1st version of subroutine;not including the behaviour assessment function