Improved startup and shutdown