startup and shutdown routines