added rudimentary tests
reorganized code and improved fitness-function