A functional approach to behaviour problems