Fixed #20; refactor GA implementation