Starting to neaten up the solution using an external transpose lib - still some way to go