All working and speedy at present, more refactoring for io to be done