separate mst function and definition