GA implementation and supporting functions