Fixed all fitness functions plus a lot of bug fixes