basically working - now to incorporate optimised training algorithm