Mostly working code

With exception to saveInBackground
Right now each material has one puzzle, so I don't think this will be a problem.