fixed a pointer issue with PID file, but otherwise, almost there
tidying some things up, probably no more major changes to this for now
nothing to upgrade the odd methods, but just splitting files