Clean up the code; switch to the latest Docker API