Added working implementation of findCodeVariant