finished the fitness funciton