updated with tidier startup sequence