Moved command execution to a separate function, so modules called in threads still get proper crash handling