updated fitModel functino and removed unused ones