Better logging and process handling functionality