REFACTORING - finished initial global variables for sanitise object
REFACTORING - write_pid done