Internal fitting function
Internal fitting and set up function.
Maintainer: Giampiero Marra giampiero.marra@ucl.ac.uk