Updated version with fitting parameters