Modified initialisation functions to return pointers, modified functions to take all required pointers as parameters.