2D and 3D algorithms now working. reading and writing to templates fully working. needs some clean up