Add helpers for state checking isLoading, isLoaded, isStarting, isStarted, isTerminating, isTerminated and clean up code.