final versions of code, run on picloyd