Implemented startup and shutdown phases. Added documentation of all phases. Closes #243.