Linted and simplified state checking code in pause and stop.