removed galois code and replaced with optimised version